<!DOCTYPE html>
<html>
<head>
    <title>识别情况</title>
    {% include 'admin/common/header.html' %}</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">课程名</label>
                <div class="layui-input-inline">
                    <input type="text" name="lesson_name" placeholder="" class="layui-input">
                </div>
                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="emotion-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
                <button type="reset" class="pear-btn pear-btn-md">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </form>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-body">
        <table id="emotion-table" lay-filter="emotion-table"></table>
    </div>
</div>
</body>

{% include 'admin/common/footer.html' %}
<script>
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup

        let MODULE_PATH = '/admin/lesson/'

        let cols = [
            [
                { title: '课程名称', field: 'lesson_name', align: 'center' },
                { title: '学生名称', field: 'student_name', align: 'center' },
                { title: '情绪', field: 'emotion', align: 'center' },
            ]
        ]

        table.render({
            elem: '#emotion-table',
            url: MODULE_PATH + 'stuEmoData',
            page: true,
            cols: cols,
            skin: 'line',
            toolbar: '#emotion-toolbar',
            defaultToolbar: [{
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }, 'filter', 'print', 'exports']
        })

        form.on('submit(emotion-query)', function (data) {
            table.reload('emotion-table', { where: data.field })
            return false
        })

        table.on('tool(emotion-table)', function (obj) {
            if (obj.event === 'emotion') {
                window.emotion(obj)
            }
        })

    })
</script>
</html>